const Router = require('koa-router');
const {db, Op,QueryTypes } = require("../../models/db");
const router = new Router();
// 换算购物车saveSale
router.post('/app/getCartNum', async ctx => {
    let usr = ctx.user
    let tenantId = usr.tenantId
    let sql = `select count(*) total from (select buId from cart where tenantId=${tenantId} and uid=${usr.id} group by buId) a  `
    let model = await db.query(sql, {type: QueryTypes.SELECT, plain: true})
    return ctx.suc('', model.total)
})

module.exports = router;
